package c.e.a.c.o;

import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.res.ColorStateList;
import android.graphics.Matrix;
import android.graphics.Matrix.ScaleToFit;
import android.graphics.PorterDuff.Mode;
import android.graphics.Rect;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.InsetDrawable;
import android.os.Build.VERSION;
import android.view.View;
import android.view.ViewTreeObserver.OnPreDrawListener;
import b.i.k.o;
import c.e.a.c.t.j;
import c.e.a.c.t.n;
import com.google.android.material.floatingactionbutton.FloatingActionButton;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.Objects;
import java.util.WeakHashMap;

/* compiled from: FloatingActionButtonImpl */
public class e {
    public static final TimeInterpolator F = c.e.a.c.c.a.c;
    public static final int[] G = new int[]{16842919, 16842910};
    public static final int[] H = new int[]{16843623, 16842908, 16842910};
    public static final int[] I = new int[]{16842908, 16842910};
    public static final int[] J = new int[]{16843623, 16842910};
    public static final int[] K = new int[]{16842910};
    public static final int[] L = new int[0];
    public final Rect A = new Rect();
    public final RectF B = new RectF();
    public final RectF C = new RectF();
    public final Matrix D = new Matrix();
    public OnPreDrawListener E;
    public j a;
    public c.e.a.c.t.g b;
    public Drawable c;
    public a d;
    public Drawable e;
    public boolean f;
    public boolean g = true;
    public float h;
    public float i;
    public float j;
    public int k;
    public final c.e.a.c.p.e l;
    public c.e.a.c.c.g m;
    public c.e.a.c.c.g n;
    public Animator o;
    public c.e.a.c.c.g p;
    public c.e.a.c.c.g q;
    public float r;
    public float s = 1.0f;
    public int t;
    public int u = 0;
    public ArrayList<AnimatorListener> v;
    public ArrayList<AnimatorListener> w;
    public ArrayList<e> x;
    public final FloatingActionButton y;
    public final c.e.a.c.s.b z;

    /* compiled from: FloatingActionButtonImpl */
    public interface e {
        void a();

        void b();
    }

    /* compiled from: FloatingActionButtonImpl */
    public interface f {
    }

    /* compiled from: FloatingActionButtonImpl */
    public abstract class h extends AnimatorListenerAdapter implements AnimatorUpdateListener {
        public boolean a;
        public float b;
        public float c;

        public h(c cVar) {
        }

        public abstract float a();

        public void onAnimationEnd(Animator animator) {
            e.this.x((float) ((int) this.c));
            this.a = false;
        }

        public void onAnimationUpdate(ValueAnimator valueAnimator) {
            if (!this.a) {
                float f;
                c.e.a.c.t.g gVar = e.this.b;
                if (gVar == null) {
                    f = 0.0f;
                } else {
                    f = gVar.a.o;
                }
                this.b = f;
                this.c = a();
                this.a = true;
            }
            e eVar = e.this;
            float f2 = this.b;
            eVar.x((float) ((int) ((valueAnimator.getAnimatedFraction() * (this.c - f2)) + f2)));
        }
    }

    /* compiled from: FloatingActionButtonImpl */
    public class a extends c.e.a.c.c.f {
        public Object evaluate(float f, Object obj, Object obj2) {
            Matrix matrix = (Matrix) obj;
            Matrix matrix2 = (Matrix) obj2;
            e.this.s = f;
            matrix.getValues(this.a);
            matrix2.getValues(this.b);
            for (int i = 0; i < 9; i++) {
                float[] fArr = this.b;
                float f2 = fArr[i];
                float[] fArr2 = this.a;
                fArr[i] = ((f2 - fArr2[i]) * f) + fArr2[i];
            }
            this.c.setValues(this.b);
            return this.c;
        }
    }

    /* compiled from: FloatingActionButtonImpl */
    public class b extends h {
        public b(e eVar) {
            super(null);
        }

        public float a() {
            return 0.0f;
        }
    }

    /* compiled from: FloatingActionButtonImpl */
    public class c extends h {
        public c() {
            super(null);
        }

        public float a() {
            e eVar = e.this;
            return eVar.h + eVar.i;
        }
    }

    /* compiled from: FloatingActionButtonImpl */
    public class d extends h {
        public d() {
            super(null);
        }

        public float a() {
            e eVar = e.this;
            return eVar.h + eVar.j;
        }
    }

    /* compiled from: FloatingActionButtonImpl */
    public class g extends h {
        public g() {
            super(null);
        }

        public float a() {
            return e.this.h;
        }
    }

    public e(FloatingActionButton floatingActionButton, c.e.a.c.s.b bVar) {
        this.y = floatingActionButton;
        this.z = bVar;
        c.e.a.c.p.e eVar = new c.e.a.c.p.e();
        this.l = eVar;
        eVar.a(G, c(new d()));
        eVar.a(H, c(new c()));
        eVar.a(I, c(new c()));
        eVar.a(J, c(new c()));
        eVar.a(K, c(new g()));
        eVar.a(L, c(new b(this)));
        this.r = floatingActionButton.getRotation();
    }

    public final void a(float f, Matrix matrix) {
        matrix.reset();
        Drawable drawable = this.y.getDrawable();
        if (drawable != null && this.t != 0) {
            RectF rectF = this.B;
            RectF rectF2 = this.C;
            rectF.set(0.0f, 0.0f, (float) drawable.getIntrinsicWidth(), (float) drawable.getIntrinsicHeight());
            int i = this.t;
            rectF2.set(0.0f, 0.0f, (float) i, (float) i);
            matrix.setRectToRect(rectF, rectF2, ScaleToFit.CENTER);
            i = this.t;
            matrix.postScale(f, f, ((float) i) / 2.0f, ((float) i) / 2.0f);
        }
    }

    public final AnimatorSet b(c.e.a.c.c.g gVar, float f, float f2, float f3) {
        ArrayList arrayList = new ArrayList();
        ObjectAnimator ofFloat = ObjectAnimator.ofFloat(this.y, View.ALPHA, new float[]{f});
        gVar.d("opacity").a(ofFloat);
        arrayList.add(ofFloat);
        ofFloat = ObjectAnimator.ofFloat(this.y, View.SCALE_X, new float[]{f2});
        String str = "scale";
        gVar.d(str).a(ofFloat);
        int i = VERSION.SDK_INT;
        if (i == 26) {
            ofFloat.setEvaluator(new f(this));
        }
        arrayList.add(ofFloat);
        ofFloat = ObjectAnimator.ofFloat(this.y, View.SCALE_Y, new float[]{f2});
        gVar.d(str).a(ofFloat);
        if (i == 26) {
            ofFloat.setEvaluator(new f(this));
        }
        arrayList.add(ofFloat);
        a(f3, this.D);
        ofFloat = ObjectAnimator.ofObject(this.y, new c.e.a.c.c.e(), new a(), new Matrix[]{new Matrix(this.D)});
        gVar.d("iconScale").a(ofFloat);
        arrayList.add(ofFloat);
        AnimatorSet animatorSet = new AnimatorSet();
        c.e.a.c.a.r(animatorSet, arrayList);
        return animatorSet;
    }

    public final ValueAnimator c(h hVar) {
        ValueAnimator valueAnimator = new ValueAnimator();
        valueAnimator.setInterpolator(F);
        valueAnimator.setDuration(100);
        valueAnimator.addListener(hVar);
        valueAnimator.addUpdateListener(hVar);
        valueAnimator.setFloatValues(new float[]{0.0f, 1.0f});
        return valueAnimator;
    }

    public float d() {
        throw null;
    }

    public void e(Rect rect) {
        int sizeDimension = this.f ? (this.k - this.y.getSizeDimension()) / 2 : 0;
        float d = this.g ? d() + this.j : 0.0f;
        int max = Math.max(sizeDimension, (int) Math.ceil((double) d));
        sizeDimension = Math.max(sizeDimension, (int) Math.ceil((double) (d * 1.5f)));
        rect.set(max, sizeDimension, max, sizeDimension);
    }

    public void f(ColorStateList colorStateList, Mode mode, ColorStateList colorStateList2, int i) {
        throw null;
    }

    public boolean g() {
        boolean z = false;
        if (this.y.getVisibility() == 0) {
            if (this.u == 1) {
                z = true;
            }
            return z;
        }
        if (this.u != 2) {
            z = true;
        }
        return z;
    }

    public boolean h() {
        boolean z = false;
        if (this.y.getVisibility() != 0) {
            if (this.u == 2) {
                z = true;
            }
            return z;
        }
        if (this.u != 1) {
            z = true;
        }
        return z;
    }

    public void i() {
        throw null;
    }

    public void j() {
        throw null;
    }

    public void k(int[] iArr) {
        throw null;
    }

    public void l(float f, float f2, float f3) {
        throw null;
    }

    public void m() {
        ArrayList arrayList = this.x;
        if (arrayList != null) {
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                ((e) it.next()).b();
            }
        }
    }

    public void n() {
        ArrayList arrayList = this.x;
        if (arrayList != null) {
            Iterator it = arrayList.iterator();
            while (it.hasNext()) {
                ((e) it.next()).a();
            }
        }
    }

    public boolean o() {
        throw null;
    }

    public final void p(float f) {
        this.s = f;
        Matrix matrix = this.D;
        a(f, matrix);
        this.y.setImageMatrix(matrix);
    }

    public void q(ColorStateList colorStateList) {
        throw null;
    }

    public final void r(j jVar) {
        this.a = jVar;
        c.e.a.c.t.g gVar = this.b;
        if (gVar != null) {
            gVar.a.a = jVar;
            gVar.invalidateSelf();
        }
        Drawable drawable = this.c;
        if (drawable instanceof n) {
            ((n) drawable).setShapeAppearanceModel(jVar);
        }
        a aVar = this.d;
        if (aVar != null) {
            aVar.o = jVar;
            aVar.invalidateSelf();
        }
    }

    public boolean s() {
        throw null;
    }

    public final boolean t() {
        FloatingActionButton floatingActionButton = this.y;
        WeakHashMap weakHashMap = o.a;
        return floatingActionButton.isLaidOut() && !this.y.isInEditMode();
    }

    public final boolean u() {
        return !this.f || this.y.getSizeDimension() >= this.k;
    }

    public void v() {
        throw null;
    }

    public final void w() {
        c.e.a.c.s.b bVar;
        com.google.android.material.floatingactionbutton.FloatingActionButton.b bVar2;
        Rect rect = this.A;
        e(rect);
        b.i.b.f.Q(this.e, "Didn't initialize content background");
        if (s()) {
            InsetDrawable insetDrawable = new InsetDrawable(this.e, rect.left, rect.top, rect.right, rect.bottom);
            com.google.android.material.floatingactionbutton.FloatingActionButton.b bVar3 = (com.google.android.material.floatingactionbutton.FloatingActionButton.b) this.z;
            Objects.requireNonNull(bVar3);
            e.super.setBackgroundDrawable(insetDrawable);
        } else {
            bVar = this.z;
            Drawable drawable = this.e;
            bVar2 = (com.google.android.material.floatingactionbutton.FloatingActionButton.b) bVar;
            Objects.requireNonNull(bVar2);
            if (drawable != null) {
                e.super.setBackgroundDrawable(drawable);
            }
        }
        bVar = this.z;
        int i = rect.left;
        int i2 = rect.top;
        int i3 = rect.right;
        int i4 = rect.bottom;
        bVar2 = (com.google.android.material.floatingactionbutton.FloatingActionButton.b) bVar;
        FloatingActionButton.this.m.set(i, i2, i3, i4);
        FloatingActionButton floatingActionButton = FloatingActionButton.this;
        int i5 = floatingActionButton.j;
        floatingActionButton.setPadding(i + i5, i2 + i5, i3 + i5, i4 + i5);
    }

    public void x(float f) {
        c.e.a.c.t.g gVar = this.b;
        if (gVar != null) {
            c.e.a.c.t.g.b bVar = gVar.a;
            if (bVar.o != f) {
                bVar.o = f;
                gVar.w();
            }
        }
    }
}
